﻿/*******************************************************************************
 * Copyright @ 2017 YunSpace.Framework 版权所有
 * Author: GaoTang
 * Description: YunSpace 快速开发平台
 * Website：http://www.yunspace.com.cn
*********************************************************************************/
#region USING SYSTEM
using System.Linq;
using System.Collections.Generic;
using YunSpace.Data;
using YunSpace.Domain.Entity.MiniSite;
using YunSpace.Domain.IRepository.MiniSite;
using System;
#endregion

namespace YunSpace.Repository.MiniSite
{
    /// <summary>
    /// HiSpace 订单业务逻辑
    /// </summary>
    public partial class SiteOrderRepository : RepositoryBase<SiteOrderEntity>, ISiteOrderRepository
    {
        /// <summary>
        /// 热门预定 
        /// 场地订单数量最多的 5 条记录
        /// </summary>
        public List<string> GetTop5SiteOrderMost()
        {
            /// SELECT so.F_SiteId
            ///     FROM MiniSite_SiteOrder so 
            ///     GROUP BY so.F_SiteId 
            ///     ORDER BY COUNT(so.F_SiteId) DESC
            ///     LIMIT 0, 5
            string sqlStr = @"SELECT so.F_SiteId
                                FROM MiniSite_SiteOrder so 
                                 GROUP BY so.F_SiteId 
                                 ORDER BY COUNT(so.F_SiteId) DESC
                                 LIMIT 0, 5";

            return GetColumnList<string>(sqlStr);
        }
       
    }
}





